 <%--
 *  File:   HospitalBuySell.jsp
 *  Desc:	the Lend slip summary page
 *
 *  Date		  Author		  Changes
 *  2011-1-25	  KevinFan		  Created
 *
 *  Copyright (C) 2000 - 2011 Oval Technologies, Inc.
 *  All rights reserved.
 *
 *  This software is the confidential and proprietary information of Oval
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%
  //init param
  String privilegeCode = "A0103";
  String strTableName = "v_zylhosppurchsalinv";
  String strModuleName = "TDR";
  String contextPath = request.getContextPath();
%>
<%@ include file="/inc/CommonHeader.inc" %>
<%@ include file="/inc/OvalLocationDefault.inc" %>

<html>
<head>
<title>HospitalBuySell</title>
<PageFlow:CheckPageFlow pageName="p_purchaseverify"/>
<%
  Vector summary = (Vector)pageContext.getAttribute("totalsummary");
  HashMap userinfo = (HashMap)session.getAttribute("userinfo");
  String  issalesman = (String) userinfo.get("issalesman");
  int endday3 = Integer.parseInt((String)pageContext.getAttribute("endday3"));
  java.util.Calendar cal = java.util.Calendar.getInstance();      
  int day = cal.get(Calendar.DAY_OF_MONTH);
  String flag = (String)pageContext.getAttribute("flag");
  if(summary == null)
    summary = new Vector();
%>
<%@ include file="/inc/CatchError.inc" %>
<%@ include file="/inc/SumDiv.inc" %>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="<%=contextPath%>/css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="<%=contextPath%>/css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/ScriptLib.js"></script>
<script language="JavaScript" src="<%=contextPath%>/js/SummaryDivision.js"></script>
<script language="JavaScript">
function page_summary(actionvalue,orderbyname)
{
  var editform = summaryPrepare(cform,actionvalue,orderbyname);
  if(!editform) return;
  editform.action = "HospitalBuySell.jsp?<%= OvalTools.randomURL() %>";
  editform.target = "_self";
  isRunning = true;
  editform.submit();
}
var initialqty;
var folwqty;
var notfolwqty;
var c;
function saveData(obj) {
	document.cform.salesqty.value = obj.value;
	
	num1 = Number(initialqty);
	num2 = Number(folwqty);
	num3 = Number(notfolwqty);
	num4 = Number(obj.value);
	if(isNaN(num4)){
		alert("请输入正确的数值！");
		obj.fouse();
		return;
	}
	document.cform.endqty.value = num1+num2+num3-num4;
	if(obj.value == "")obj.value=c;
    document.cform.actionname.value = "savehbs";
  	document.cform.target = "_self";
  	isRunning = true;
  	document.cform.submit(); 
  	alert(document.cform.salesqty.value);  
}

function subDiv() {
   	document.cform.actionname.value = "savepurchase";
  	document.cform.target = "_self";
  	isRunning = true;
  	document.cform.submit();
}
//tongguo is yesorno
function getPass() {
	 if(isNullChecked(cform.deleteids)) 
	  {
	    alert('<%=message.getMessageDesc("PLEASE_SELECT")%>');
	    return;
	  }
	cform.changestatus.value = 51;
   	document.cform.actionname.value = "yonpass";
  	document.cform.target = "_self";
  	isRunning = true;
  	document.cform.submit();
}

function getnoPass() {
	if(isNullChecked(cform.deleteids)) 
	 {
	   alert('<%=message.getMessageDesc("PLEASE_SELECT")%>');
	   return;
	  }
	cform.changestatus.value = 52;
   	document.cform.actionname.value = "yonpass";
  	document.cform.target = "_self";
  	isRunning = true;
  	document.cform.submit();
}
function showDiv(element) {
    var W = document.documentElement.scrollWidth;
    var H = document.documentElement.scrollHeight;
    var selfW = document.getElementById(element).style.width;
    var selfH = document.getElementById(element).style.height;
    document.getElementById(element).style.left = (W - parseInt(selfW)) / 2 + 'px';
    document.getElementById(element).style.top = (H - parseInt(selfH)) / 2 + 'px';
    document.getElementById(element).style.display = 'block';
    var mDiv = document.getElementById("mDiv");
    mDiv.style.display = '';
    document.cform.subbutton.focus();
}


function updateDiv(element) {
	var tdrstatus = document.cform.tdrstatus.value;
	var tdr = Number(tdrstatus);
	if(tdr ==51){
    alert("你不能修改此信息！");
    return ;
	}
	page_setInput();
    var W = document.documentElement.scrollWidth;
    var H = document.documentElement.scrollHeight;
    var selfW = document.getElementById(element).style.width;
    var selfH = document.getElementById(element).style.height;
    document.getElementById(element).style.left = (W - parseInt(selfW)) / 2 + 'px';
    document.getElementById(element).style.top = (H - parseInt(selfH)) / 2 + 'px';
    document.getElementById(element).style.display = 'block';
    var mDiv = document.getElementById("mDiv");
    mDiv.style.display = '';
    document.cform.subbutton.focus();
    
}

function hidDiv(element) {
    document.getElementById(element).style.display = 'none';
    document.getElementById("mDiv").style.display = 'none';
}

function editMode(obj,i,n1,n2,n3,n4,id,name) {
        initialqty = n1;
        folwqty= n2;
        notfolwqty = n3;
        endqty = n4;
        if(document.getElementById(name+"_"+id)!=null)return;
        if (endqty<0) {
            c = Trim(obj.innerText);
			inputobj = "<input type='text' name='"+name+"_' id='"+name+"_"+id+"' value='"+c+"' size='10' onblur='saveData(this)' >"; 
	        obj.innerHTML=inputobj;
            document.getElementById(name+"_"+id).focus()
        }
}

function clickRow(obj,idx)
{
  
  var cform = document.cform;
  cform.salesmonthdataid.value = eval('obj.all.salesmonthdataid'+idx).value;
  cform.purchasemonthdataid.value = eval('obj.all.purchasemonthdataid'+idx).value;
  cform.orgcode.value = eval('obj.all.orgcode'+idx).value;
  cform.orgname.value = eval('obj.all.orgname'+idx).value;
  cform.orgrepname.value = eval('obj.all.orgrepname'+idx).value;
  cform.prodcode.value = eval('obj.all.prodcode'+idx).value;
  cform.prodname.value = eval('obj.all.prodname'+idx).value;
  cform.initialqty.value = eval('obj.all.initialqty'+idx).value;
  cform.folwqty.value = eval('obj.all.folwqty'+idx).value;
  cform.notfolwqty.value = eval('obj.all.notfolwqty'+idx).value;
  cform.invqty.value = eval('obj.all.invqty'+idx).value;
  cform.notfolwqty.value = eval('obj.all.notfolwqty'+idx).value;
  cform.salesqty.value = eval('obj.all.salesqty'+idx).value;
  cform.invqty.value = eval('obj.all.invqty'+idx).value;
  cform.endqty.value = eval('obj.all.endqty'+idx).value;
  cform.remark.value = eval('obj.all.remark'+idx).value;
  cform.tdrstatus.value = eval('obj.all.tdrstatus'+idx).value;
  cform.status.value = eval('obj.all.status'+idx).value;
  page_setInput();
}

function page_setInput(){
  cform.salesmonthdata_id.value = cform.salesmonthdataid.value;
  cform.purchasemonthdata_id.value = cform.purchasemonthdataid.value;
  cform.partner_code.value = cform.orgcode.value;
  cform.partner_name.value = cform.orgname.value;
  cform.user_name.value = cform.orgrepname.value;
  cform.prod_code.value = cform.prodcode.value;
  cform.prod_name.value = cform.prodname.value;
  cform.initial_qty.value = cform.initialqty.value;
  cform.folw_qty.value = cform.folwqty.value;
  cform.notfolw_qty.value = cform.notfolwqty.value;
  cform.stock_qty.value = cform.invqty.value;
  cform.notfolw_qty.value = cform.notfolw_qty.value;
  cform.sales_qty.value = cform.salesqty.value;
  cform.stock_qty.value = cform.invqty.value;
  cform.ent_qty.value = cform.endqty.value;
  cform.re_mark.value = cform.remark.value;
}

//salesman
function popRep() {
	var regionid=cform.regionid.value;
	var proviceofficecode = document.cform.proviceofficelist.value;
	var businessareacode = document.cform.businessarealist.value;
	//alert(regionid+"|"+proviceofficeid+"|"+areaid+"|");
	var status = "height=400, width=600, top=100, left=100, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no";
	var url = "SalesPopWindow.jsp?<%= OvalTools.randomURL() %>&regionid="+regionid+"&proviceofficecode="+proviceofficecode+"&businessareacode="+businessareacode;
	popwindow = window.open(url, "newwindow", status);
  }

function SetSalesMan(id,code,name){
	cform.userids.value=id;
	cform.employeecode.value=code;
	cform.employeename.value=name;
}

//getbusinessarea
function page_getpriviceoffice(){
	var objdeptcode=eval("cform.regionid");
	var businesstype = document.cform.businesstype.value;
	if (objdeptcode==""){
	    return;
	}
	var  datahandler = new  DataHandler();
	datahandler.add_params("regionid" , objdeptcode.value , "Integer");
	datahandler.add_params("businesstype" , businesstype , "Integer");
	datahandler.getResultFromVector("resultproviceoffice","proviceofficename","proviceofficecode","document.cform.proviceofficelist");
	datahandler.add_job("j_purchaseverify");
	datahandler.runDataHandler();
  }



function page_getbusinessarea(){
	var regionid = document.cform.regionid.value;
	var objdeptcode=eval("cform.proviceofficelist");
	var businesstype = document.cform.businesstype.value;
	if (objdeptcode==""){
	    return;
	}
	var  datahandler = new  DataHandler();
	datahandler.add_params("regionid" , regionid, "Integer");
	datahandler.add_params("businesstype" , businesstype , "Integer");
	datahandler.add_params("proviceofficelist" , objdeptcode.value , "String");
	datahandler.getResultFromVector("resultbusinessarea","businessareaname","businessareacode","document.cform.businessarealist");
	datahandler.add_job("j_purchaseverify");
	datahandler.runDataHandler();
 }

function page_allcheckselect(){
	var allcheck = cform.allcheck.checked;
	var alldatafile = document.getElementsByName('deleteids');
	var length = alldatafile.length;
	if(allcheck){
		for(var i = 1 ; i <= length;i++){
			alldatafile[i-1].checked = true;
		}
	}else{
		for(var i = 1 ; i <= length;i++){
			alldatafile[i-1].checked = false;
		}	
	}
}

</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" >
<iframe id="reloadHandler" name="reloadHandler" style="display:none"></iframe>
<form name="cform" method="post" action="<%=contextPath%>/Dispatcher">
  <input type="hidden" name="pagename" value="p_purchaseverify">
  <input type="hidden" name="actionname">
      <custom:hidden property="changestatus"/>
  <custom:hidden property="businesstype"/>
<%@ include file="/inc/PageLocation.inc" %>
<table width="100%" cellspacing="0" border="0" cellpadding="0">
  <tr>
    <td>
      <table width="100%" border="0" cellspacing="0">
        <tr>
          <td class="summary_top" width="10%" colspan="3" ></td>
        </tr>
        <%@ include file="/inc/SummarySearch.inc" %>
      </table>
    </td>
  </tr>
  <tr>
    <td>
       <table width="700" border="0" cellspacing="0" >
        	<tr>
        		<% 
        		 // HashMap userinfo = (HashMap)session.getAttribute("userinfo");
		          // String  issalesman = (String) userinfo.get("issalesman");  
					String year = cal.get(Calendar.YEAR)+"";     
					String month = cal.get(Calendar.MONTH)+"";
					if(cal.get(Calendar.MONTH) == 0){
						month = "12";
						year = (cal.get(Calendar.YEAR)-1)+"";
					}  
					if("first".equals(flag)){ 
				%>
	        	<td style="width:40px;" class="td_right" ><%=label.getLabelName("L_Year1") +  label.getLabelName("L_Colon") %></td>
	        	<td style="width:50px;" class="td_left"><custom:selectdic property="years" dictType="Years" command="notnull" value="<%=year %>" label="L_Year1"/></td>
	        	<td style="width:40px;" class="td_right"><%=label.getLabelName("L_Month") +  label.getLabelName("L_Colon") %></td>
	        	<td style="width:50px;" class="td_left"><custom:selectdic property="months" dictType="Months" command="notnull" value="<%=month %>" label="L_Month"/></td>
	        	<%}else{ %>
	        	<td style="width:40px;" class="td_right"><%=label.getLabelName("L_Year1") +  label.getLabelName("L_Colon") %></td>
	        	<td style="width:50px;" class="td_left"><custom:selectdic property="years" dictType="Years" command="notnull" label="L_Year1"/></td>
	        	<td style="width:40px;" class="td_right"><%=label.getLabelName("L_Month") +  label.getLabelName("L_Colon") %></td>
	        	<td style="width:50px;" class="td_left"><custom:selectdic property="months" dictType="Months" command="notnull" label="L_Month"/></td>
	        	    <%
	        	    }
	                if("Y".equals(issalesman)){
			        %>
	        	<td style="width:40px;" class="td_right"><%=label.getLabelName("L_Status") +  label.getLabelName("L_Colon") %></td>
	        	<td style="width:50px;" class="td_left"><custom:selectdic property="status" dictType="ZylStatus" valueCriteria="41,28" defaultValue="-------"  defaultValueCost="" command="notnull" label="Status"/></td>
        	    <%}else{ %>
        	    <td style="width:40px;" class="td_right"><%=label.getLabelName("L_Status") +  label.getLabelName("L_Colon") %></td>
	        	<td style="width:50px;" class="td_left"><custom:selectdic property="status" dictType="ZylStatus" valueCriteria="40,28,41" defaultValue="-------" defaultValueCost="" command="notnull" label="Status"/></td>
        	    <%}%> 
				</tr>
				</table>
				</td></tr>
				<tr>
				<td>
				<table width="1000" border="0" cellspacing="0" >
        	      <% 
	                if("Y".equals(issalesman)){
	             %> 
	            <tr>
	               <td style="width:40px;">&nbsp;</td><td style="width:150px;">&nbsp;</td>
	               <td style="width:40px;">&nbsp;</td><td style="width:150px;">&nbsp;</td>
	               <td style="width:40px;">&nbsp;</td><td style="width:150px;">&nbsp;</td>
	               <td style="width:60px;">&nbsp;</td><td style="width:150px;">&nbsp;</td>
	               <td style="width:60px;">&nbsp;</td><td style="width:150px;">&nbsp;</td>
	            </tr>
	            <%}else{ %>
        	    <tr>
        	    <td style="width:40px;" class="td_right"><%=label.getLabelName("L_Businessarea") +  label.getLabelName("L_Colon") %></td>
        	  	<td style="width:150px;" class="td_left"><custom:select property="regionid" optionInnerTextKey="regionname" optionsName="resultregion" optionValueKey="regionid" style="width:150px;" onchange="page_getpriviceoffice();" defaultValue="ALL" defaultValueCost=""/></td>
        	    <td style="width:40px;" class="td_right"><%=label.getLabelName("L_ProvinceOffice") +  label.getLabelName("L_Colon") %></td>
				<td style="width:150px;" class="td_left">
				<custom:select property="proviceofficelist" optionInnerTextKey="proviceofficename" optionsName="resultproviceoffice" optionValueKey="proviceofficecode" style="width:150px;" defaultValue="----------" defaultValueCost="" onchange="page_getbusinessarea();"/></td>
			    <td style="width:60px;" class="td_right"><%=label.getLabelName("L_BusinessAreaName") +  label.getLabelName("L_Colon") %></td>
				<td style="width:150px;" class="td_left">
				<custom:select property="businessarealist" optionInnerTextKey="businessareaname" optionsName="resultbusinessarea" optionValueKey="businessareacode" style="width:150px;" defaultValue="----------" defaultValueCost=""/> </td>
        	     <td style="width:60px;" class="td_right"><%=label.getLabelName("L_BusinessContact") +  label.getLabelName("L_Colon") %></td>
				<td style="width:150px;">
			<custom:text property="employeename" size="20" readonly="true" style="border:1px #7F9DB9 solid;"/>
			<a onClick="javascript:popRep();"><custom:button type="3" label="L_Asterisk" imgsrc="flash.gif" border="0"/></a> 
			<custom:hidden property="userids"/>
			<custom:hidden property="employeecode"/>
		   </td>
				<td style="20px;"><button type="reset" class="button1" name="re" value="clear"  style="width:60"><%=label.getLabelName("L_Clear") %></button></td>
			<%} %>
        	</tr>
          </table>
    </td>
  </tr>
  <tr>
    <td>
      <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
        <tr class="deepblue-left"> 
       
        <td width="1%" class="title_center">&nbsp;</td>
        <%--
         <td width="1%" class="title_center"><input type="checkbox" name="allcheck" class="normalradio" onclick="page_allcheckselect();"></td>
         --%>
    
          <td class="title_center" width="*" ><a href="javascript:page_summary('orderby','orgcode')"><%= label.getLabelName("L_Hospital") %></a></td>
          <!-- <td class="title_center" width="7%" ><a href="javascript:page_summary('orderby','orgname')"><%= label.getLabelName("L_HospitalName") %></a></td> -->
          <td class="title_center" width="7%"><a href="javascript:page_summary('orderby','orgrepname')"><%= label.getLabelName("L_Representative") %></a></td>
          <td class="title_center" width="12%" ><a href="javascript:page_summary('orderby','prodcode')"><%= label.getLabelName("L_Product") %></a></td>
          <!-- <td class="title_center" width="7%" ><a href="javascript:page_summary('orderby','prodname')"><%= label.getLabelName("L_ProdName") %></a></td> -->
          <td class="title_center" width="7%" ><a href="javascript:page_summary('orderby','initialqty')"><%= label.getLabelName("L_InitialQty") %></a></td>
          <td class="title_center" width="9%" ><a href="javascript:page_summary('orderby','folwqty')"><%= label.getLabelName("L_FlowQty") %></a></td>
          <td class="title_center" width="7%" ><a href="javascript:page_summary('orderby','notfolwqty')"><%= label.getLabelName("L_NotFlowQty") %></a></td>
          <td class="title_center" width="7%" ><a href="javascript:page_summary('orderby','salesqty')"><%= label.getLabelName("L_SalesQty") %></a></td>
          <td class="title_center" width="7%" ><a href="javascript:page_summary('orderby','invqty')"><%= label.getLabelName("L_StockQty") %></a></td>
          <td class="title_center" width="7%" ><a href="javascript:page_summary('orderby','endqty')"><%= label.getLabelName("L_EntQty") %></a></td>
        <td class="title_center" width="7%" ><a href="javascript:page_summary('orderby','status')"><%= label.getLabelName("L_BusinessStatus") %></a></td>
        <td class="title_center" width="7%" ><a href="javascript:page_summary('orderby','tdrstatus')"><%= label.getLabelName("L_IntoBuyStore") %></a></td>
       <td class="title_center" width="7%" ><a href="javascript:page_summary('orderby','remark')"><%= label.getLabelName("L_NoteThat") %></a></td>
        </tr> 
        <tbody> 
          <%
            Integer nDefaultId = new Integer(-1);
            Integer tdrStatus1 = new Integer(-1);
            int i=0;
            String tdrstatus = "";
            String strChecked = "";
            String strClassType = "none";
            boolean bHasChecked = false;
          %>
          <logic:iterate id="onerow" collection="<%= summary %>">
          <%
            if(i%2 == 1){
              strClassType = "td-listrom";
            }else{
              strClassType = "none";
            }
            if(!bHasChecked){
              nDefaultId = (Integer)((HashMap)pageContext.getAttribute("onerow")).get("salesmonthdataid");
              tdrStatus1  = (Integer)((HashMap)pageContext.getAttribute("onerow")).get("tdrstatus"); 
              tdrstatus= ""+tdrStatus1;
              bHasChecked = true;
              strChecked = "Checked";
            }else{
              strChecked = "";
            }
            i++;
          %>
          <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'" onClick="radiotrue('radio<%=JspHelper.filterNull( i )%>');javascript:clickRow(this,<%=JspHelper.filterNull( i ) %>);" class="<%=JspHelper.filterNull( strClassType )%>">
        <% if("Y".equals(issalesman)){%>
            <td>
              <input <%=JspHelper.filterNull( strChecked )%> id="radio<%=JspHelper.filterNull(i)%>" name="radiorow" type="radio" class="normalradio">
            </td>
          <%}  else{
        	  if(tdrstatus.equals("41")){
        	  %>
              <td class="title_center">
	             <input id="deleteids<%=JspHelper.filterNull(i)%>" name="deleteids" type="checkbox" value="<custom:write name="onerow" property="salesmonthdataid"/>" class="normalradio" disabled="disabled">
	            </td>
	        <%}else{ %>
	          <td class="title_center">
              
	             <input id="deleteids<%=JspHelper.filterNull(i)%>" name="deleteids" type="checkbox" value="<custom:write name="onerow" property="salesmonthdataid"/>" class="normalradio">
	            </td>
	             
	            <% }}%>
            
            <td><custom:write name="onerow" property="orgcode" nbsp="true"/>&nbsp;<custom:write name="onerow" property="orgname" nbsp="true"/></td>
            <!-- <td><custom:write name="onerow" property="orgname" nbsp="true"/></td> -->
            <td><custom:write name="onerow" property="orgrepname" nbsp="true"/></td>
            <td><custom:write name="onerow" property="prodcode" nbsp="true"/>&nbsp;<custom:write name="onerow" property="prodname" nbsp="true"/></td>
            <!-- <td><custom:write name="onerow" property="prodname" nbsp="true"/></td> -->
            <td><custom:write name="onerow" property="initialqty" nbsp="true"/></td>
            <td><custom:write name="onerow" property="folwqty" nbsp="true"/></td>
            <td><custom:write name="onerow" property="notfolwqty" nbsp="true"/></td>
            <td onclick="editMode(this,<%=JspHelper.filterNull(i)%>,<custom:write name="onerow" property="initialqty" nbsp="true"/>,<custom:write name="onerow" property="folwqty" nbsp="true"/>,<custom:write name="onerow" property="notfolwqty" nbsp="true"/>,<custom:write name="onerow" property="endqty" nbsp="true"/>,<custom:write name="onerow" property="salesmonthdataid"/>,'salesqty')"><custom:write name="onerow" property="salesqty" nbsp="true"/></td>
            <td><custom:write name="onerow" property="invqty" nbsp="true"/></td>
            <td><custom:write name="onerow" property="endqty" nbsp="true"/></td>
            <td><custom:write  name="onerow" property="status" nbsp="true" dictType="ZylStatus"/></td>
            <td><custom:write  name="onerow" property="tdrstatus" nbsp="true" dictType="ZylStatus"/>
            </td>
            <td><custom:write name="onerow" property="remark" nbsp="true"/>
            <%
            String str1 = "salesmonthdataid"+JspHelper.filterNull(i);
            String str2 = "orgcode"+JspHelper.filterNull(i);
            String str3 = "orgname"+JspHelper.filterNull(i);
            String str4 = "orgrepname"+JspHelper.filterNull(i);
            String str5 = "prodcode"+JspHelper.filterNull(i);
            String str6 = "prodname"+JspHelper.filterNull(i);
            String str7 = "initialqty"+JspHelper.filterNull(i);
            String str8 = "folwqty"+JspHelper.filterNull(i);
            String str9 = "notfolwqty"+JspHelper.filterNull(i);
            String str10 = "salesqty"+JspHelper.filterNull(i);
            String str11 = "invqty"+JspHelper.filterNull(i);
            String str12 = "endqty"+JspHelper.filterNull(i);
            String str13 = "remark"+JspHelper.filterNull(i);
            String str15 = "tdrstatus"+JspHelper.filterNull(i);
            String str16 = "status"+JspHelper.filterNull(i);
            String str14 = "purchasemonthdataid"+JspHelper.filterNull(i);
           
            if(i==1){
	        %>
	        <custom:hidden name="onerow" property="purchasemonthdataid"/>
	        <custom:hidden name="onerow" property="salesmonthdataid"/>
            <custom:hidden name="onerow" property="orgcode"/>
            <custom:hidden name="onerow" property="orgname"/>
            <custom:hidden name="onerow" property="orgrepname"/>
            <custom:hidden name="onerow" property="prodcode"/>
            <custom:hidden name="onerow" property="prodname"/>
            <custom:hidden name="onerow" property="initialqty"/>
            <custom:hidden name="onerow" property="folwqty"/>
            <custom:hidden name="onerow" property="notfolwqty"/>
            <custom:hidden name="onerow" property="salesqty"/>
            <custom:hidden name="onerow" property="invqty"/>
            <custom:hidden name="onerow" property="endqty"/>
            <custom:hidden name="onerow" property="remark"/>
            <custom:hidden name="onerow" property="tdrstatus"/>
            <custom:hidden name="onerow" property="status"/>
	        <%}%>
	         <custom:hidden name="onerow" property="purchasemonthdataid" changedName="<%=str14 %>"/>
            <custom:hidden name="onerow" property="salesmonthdataid" changedName="<%=str1 %>"/>
            <custom:hidden name="onerow" property="orgcode" changedName="<%=str2 %>"/>
            <custom:hidden name="onerow" property="orgname" changedName="<%=str3 %>"/>
            <custom:hidden name="onerow" property="orgrepname" changedName="<%=str4 %>"/>
            <custom:hidden name="onerow" property="prodcode" changedName="<%=str5 %>"/>
            <custom:hidden name="onerow" property="prodname" changedName="<%=str6 %>"/>
            <custom:hidden name="onerow" property="initialqty" changedName="<%=str7 %>"/>
            <custom:hidden name="onerow" property="folwqty" changedName="<%=str8 %>"/>
            <custom:hidden name="onerow" property="notfolwqty" changedName="<%=str9 %>"/>
            <custom:hidden name="onerow" property="salesqty" changedName="<%=str10 %>"/>
            <custom:hidden name="onerow" property="invqty" changedName="<%=str11 %>"/>
            <custom:hidden name="onerow" property="endqty" changedName="<%=str12 %>"/>
            <custom:hidden name="onerow" property="remark" changedName="<%=str13 %>"/>
            <custom:hidden name="onerow" property="tdrstatus" changedName="<%=str15 %>"/>
            <custom:hidden name="onerow" property="status" changedName="<%=str16 %>"/>
            </td>
          </tr>
          </logic:iterate>
        </tbody> 
        <tfoot> 
        <%if(i%2 == 1){
              strClassType = "td-listrom";
            }else{
              strClassType = "none";
            } %>
        <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'"  class="<%=JspHelper.filterNull( strClassType )%>">
          <td colspan="3">&nbsp;</td>
          <td class="td_right"><span class="b"><%= label.getLabelName("L_Sum") + label.getLabelName("L_Colon")%></span></td>
          <td><custom:write name="totaldata" property="totalinitialqty" nbsp="true"/></td>
          <td><custom:write name="totaldata" property="totalfolwqty" nbsp="true"/></td>
          <td><custom:write name="totaldata" property="totalnotfolwqty" nbsp="true"/></td>
          <td><custom:write name="totaldata" property="totalsalesqty" nbsp="true"/></td>
          <td><custom:write name="totaldata" property="totalstockqty" nbsp="true"/></td>
          <td><custom:write name="totaldata" property="totalentqty" nbsp="true"/></td>
          <td colspan="13">
          <%@ include file="/inc/SummaryAction.inc" %>
          </td>
        </tr>
        </tfoot> 
      </table>
      <table width="100%" cellspacing="0" cellpadding="0">
            <tr><td class="summary_top"></td></tr>
            <tr>
            <td width="45%">  </td>
              <td>
              <% if("Y".equals(issalesman)){ 

              %>
              	<%if(pageContext.getAttribute("totalsummary")!=null && day<endday3){%>
              	<a onclick="updateDiv('submit')" ><custom:button type="1" label="L_Addremark" imgsrc="print.gif" border="0" style="width:60" /></a>
              	<%} %>
              </td>&nbsp;&nbsp;&nbsp;
              <%}else{ %>
                <td >
              	<%if(pageContext.getAttribute("totalsummary")!=null){%>
              	<a onclick="getPass();" ><custom:button type="1" label="L_CheckPass" imgsrc="print.gif" border="0" style="width:60" /></a>
              	<%} %>
              </td>&nbsp;&nbsp;&nbsp;
                <td>
              	<%if(pageContext.getAttribute("totalsummary")!=null){%>
              	<a onclick="getnoPass();" ><custom:button type="1" label="L_CheckNotPass" imgsrc="print.gif" border="0" style="width:60" /></a>
              	<%} %>
              </td>
              <%} %>
              <td width="45%"></td>
            </tr>
      </table>
    </td>
  </tr>
 </table>
<!-- Large Text Input Window -->
<div id="submit" class="deepblue-left"
     style="width:1000px;height:125px;border:5px #999999 double;position:absolute;display:none">
    <div id="close" class="deepblue-left" style="width:1000px;height:21px;text-align:right;cursor:move;"><img
            src="../../images/closeXXX.jpg" style="cursor:hand" onclick="hidDiv('submit')"></div>
    <div style="text-algin:center;height:100px;">
        <table cellspacing="0" cellpadding="0">
            <tr>
                <td height="100px">
                    <table border="1" width="1000px" height="104px" cellspacing="0" cellpadding="0" align="center">
                        <tr>
                          <td><%= label.getLabelName("L_HospitalCode") %></td>
				          <td><%= label.getLabelName("L_HospitalName") %></td>
				          <td><%= label.getLabelName("L_Representative") %></td>
				          <td><%= label.getLabelName("L_ProductCode") %></td>
				          <td><%= label.getLabelName("L_ProdName") %></td>
				          <td><%= label.getLabelName("L_InitialQty") %></td>
				          <td><%= label.getLabelName("L_FlowQty") %></td>
				          <td><%= label.getLabelName("L_NotFlowQty") %></td>
				          <td><font color="red"><%= label.getLabelName("L_SalesQty") %></font></td>
				          <td><%= label.getLabelName("L_StockQty") %></td>
				          <td><%= label.getLabelName("L_EntQty") %></td>
				     
				        </tr> 
				        <tr>
				          <td><custom:text  property="partner_code" size="8" readonly="true" style="border:0px;"/></td>
			              <td><custom:text  property="partner_name" size="18" readonly="true" style="border:0px;"/></td>
			              <td><custom:text  property="user_name" size="8" readonly="true" style="border:0px;"/></td>
			              <td><custom:text  property="prod_code" size="8" readonly="true" style="border:0px;"/></td>
			              <td><custom:text  property="prod_name" size="15" readonly="true" style="border:0px;"/></td>
			              <td><custom:text  property="initial_qty" size="8" readonly="true" style="border:0px;"/></td>
			              <td><custom:text  property="folw_qty" size="10" readonly="true" style="border:0px;"/></td>
			              <td><custom:text  property="notfolw_qty" size="10" readonly="true" style="border:0px;"/></td>
			              <td><custom:text  property="sales_qty" size="10"/>
			              <custom:hidden    property="salesmonthdata_id"></custom:hidden></td>
			              <td><custom:text  property="stock_qty" size="10" readonly="true" style="border:0px;"/></td>
			              <td><custom:text  property="ent_qty" size="8" readonly="true" style="border:0px;"/></td>
			         
				        </tr>
                        <tr>
                        <td align="right"><font color="red"><%= label.getLabelName("L_NoteThat") + label.getLabelName("L_Colon") %></font></td>
                        <td colspan="11"><custom:textarea property="re_mark" cols="40" rows="3"/>
                        <custom:hidden property="purchasemonthdata_id"/></td>
                        </tr>
                        <tr>
                            <td class="td_center" colspan="12">
                                <input type="button" name="subbutton" value="<%=label.getLabelName("L_Confirm")%>"
                                       onclick="subDiv()"/>
                                <custom:button label="L_Cancel" onclick="hidDiv('submit')"></custom:button>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </div>
</div>
</form>
<iframe name="reloadHandler" style="display:none"></iframe>
<script type="text/javascript">
window.onload = function() {
    var newMask = document.createElement("div");
    newMask.id = "mDiv";
    newMask.style.position = "absolute";
    newMask.style.zIndex = "5000";
    _scrollWidth = Math.max(document.body.scrollWidth, document.documentElement.scrollWidth);
    _scrollHeight = Math.max(document.body.scrollHeight, document.documentElement.scrollHeight);
    newMask.style.width = "100%";
    newMask.style.height = "100%";
    newMask.style.top = "0px";
    newMask.style.left = "0px";
    newMask.style.background = "#33393C";
    newMask.style.filter = "alpha(opacity=40)";
    newMask.style.opacity = "0.40";
    newMask.style.display = 'none';
    newMask.innerHTML = '<iframe style="position:absolute;top:0;left:0;width:100%;height:100%;filter:alpha(opacity=0);"></iframe>'
    document.body.appendChild(newMask);
    document.getElementById("submit").style.zIndex = "5002";
    var drag = false;
    var dragX = 0;
    var dragY = 0;
    objDrag.attachEvent("onmousedown", startDrag);
    function startDrag() {
        if (event.button == 1 && event.srcElement.tagName.toUpperCase() == "DIV") {
            event.srcElement.setCapture();
            event.srcElement.style.background = "#ECECEC";
            drag = true;
            dragX = event.clientX;
            dragY = event.clientY;
        }
    };
    objDrag.attachEvent("onmousemove", Drag);
    function Drag() {
        if (drag) {
            var oldwin = event.srcElement.parentNode;
            oldwin.style.left = oldwin.offsetLeft + event.clientX - dragX;
            oldwin.style.top = oldwin.offsetTop + event.clientY - dragY;
            oldwin.style.left = event.clientX - 100;
            oldwin.style.top = event.clientY - 10;
            dragX = event.clientX;
            dragY = event.clientY;
        }
    };
    objDrag.attachEvent("onmouseup", stopDrag);
    function stopDrag() {
        event.srcElement.style.background = "#90AAC5";
        event.srcElement.releaseCapture();
        drag = false;
    };
}

</script>
</body>
</html>
